<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <yan-zhen :arr="arr"></yan-zhen>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        Vue.component('yan-zhen',{
            props:{
                //父组件传给子组件的数据可以通过props对象的形式定义自定义属性接收，并且定义对应的规则
                arr:{
                    type: Array,
                    required: true
                }
            },
            data:()=> {
                return{

                }
            },
            template:`<div>
                        <ul>
                            <li :key="index" v-for="(item,index) in arr">{{item}}</li>
                        </ul>
                     </div>`
        })
        const ve = new Vue({
            el:'#app',
            data:{
                arr:['apple','orange','blanna']
            },
            
        })
    </script>
</body>
</html>